package com.ruoyi.zxjd.work.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.zxjd.work.domain.WorkTemplateTable9;
import com.ruoyi.zxjd.work.domain.bo.WorkProgressBO;
import com.ruoyi.zxjd.work.mapper.WorkTemplateTable9Mapper;
import com.ruoyi.zxjd.work.service.ICommonWorkTemplateTableService;
import com.ruoyi.zxjd.work.service.IWorkTemplateTable9Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 宜宾市纪委监委信访举报转办件办理情况反馈Service业务层处理
 *
 * @author zj
 * @date 2021-03-20
 */
@Service
public class WorkTemplateTable9ServiceImpl implements IWorkTemplateTable9Service {
    @Autowired
    private WorkTemplateTable9Mapper workTemplateTable9Mapper;
    @Autowired
    private WorkProgressServiceImpl workProgressService;

    @Autowired
    private ICommonWorkTemplateTableService commonWorkTemplateTableService;

    /**
     * 查询宜宾市纪委监委信访举报转办件办理情况反馈
     *
     * @param id 宜宾市纪委监委信访举报转办件办理情况反馈ID
     * @return 宜宾市纪委监委信访举报转办件办理情况反馈
     */
    @Override
    public WorkTemplateTable9 selectWorkTemplateTable9ById(Long id) {
        return workTemplateTable9Mapper.selectWorkTemplateTable9ById(id);
    }

    /**
     * 查询宜宾市纪委监委信访举报转办件办理情况反馈列表
     *
     * @param workTemplateTable9 宜宾市纪委监委信访举报转办件办理情况反馈
     * @return 宜宾市纪委监委信访举报转办件办理情况反馈
     */
    @Override
    public List<WorkTemplateTable9> selectWorkTemplateTable9List(WorkTemplateTable9 workTemplateTable9) {
        return workTemplateTable9Mapper.selectWorkTemplateTable9List(workTemplateTable9);
    }

    /**
     * 新增宜宾市纪委监委信访举报转办件办理情况反馈
     *
     * @param workProgressBO 宜宾市纪委监委信访举报转办件办理情况反馈
     * @return 结果
     */
    @Override
    public int insertWorkTemplateTable9(WorkProgressBO workProgressBO) {

        commonWorkTemplateTableService.insertOrUpdate(workProgressBO, "getWorkTemplateTable9", workTemplateTable9Mapper);

        return workProgressService.validate( workProgressBO.getWorkProgress());
    }


    /**
     * 修改宜宾市纪委监委信访举报转办件办理情况反馈
     *
     * @param workTemplateTable9 宜宾市纪委监委信访举报转办件办理情况反馈
     * @return 结果
     */
    @Override
    public int updateWorkTemplateTable9(WorkTemplateTable9 workTemplateTable9) {
        workTemplateTable9.setUpdateBy(ShiroUtils.getLoginName());
        workTemplateTable9.setUpdateTime(DateUtils.getNowDate());
        return workTemplateTable9Mapper.updateWorkTemplateTable9(workTemplateTable9);
    }

    /**
     * 删除宜宾市纪委监委信访举报转办件办理情况反馈对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteWorkTemplateTable9ByIds(String ids) {
        return workTemplateTable9Mapper.deleteWorkTemplateTable9ByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除宜宾市纪委监委信访举报转办件办理情况反馈信息
     *
     * @param id 宜宾市纪委监委信访举报转办件办理情况反馈ID
     * @return 结果
     */
    @Override
    public int deleteWorkTemplateTable9ById(Long id) {
        return workTemplateTable9Mapper.deleteWorkTemplateTable9ById(id);
    }

    @Override
    public List<WorkTemplateTable9> selectWorkTemplateTable9ByProgressId(Long progressId) {
        return workTemplateTable9Mapper.selectWorkTemplateTable9ByProgressId(progressId);
    }

    @Override
    public WorkTemplateTable9 selectWorkTemplateTableByProgressIdLimit1(Long progressId) {
        return workTemplateTable9Mapper.selectWorkTemplateTableByProgressIdLimit1(progressId);
    }


    //利用反射赋值测试
    /*    public static void main(String[] args) {

     *//*  WorkTemplateTable9 workTemplateTable9 = new WorkTemplateTable9();
            String content = "beiz";
            reflectField(workTemplateTable9, "val1", content);

            System.out.println(workTemplateTable9);*//*

        WorkProgressBO workProgressBO = new WorkProgressBO();
        WorkTemplateTable9 templateTable9 = new WorkTemplateTable9();
        templateTable9.setVal1("111");
        workProgressBO.setWorkTemplateTable9(templateTable9);

        Object getWorkTemplateTable9 = reflectMethod(workProgressBO, "getWorkTemplateTable9");
        System.out.println(getWorkTemplateTable9);
    }*/


}
